package it.gameplanet.client.widgets.articolo;

import it.gameplanet.client.GamePlanetContext;
import it.gameplanet.client.utils.AbstractAsyncCallback;
import it.gameplanet.client.widgets.support.Dialogs;
import it.gameplanet.model.Articolo;
import it.gameplanet.service.GamePlanetService;

public class CreaArticolo extends AbstractDettaglioArticolo {

	public CreaArticolo(final Articolo articolo) {
		super(articolo);
	}

	@Override
	public void callRemoteAsyncService(Articolo articolo) {
		GamePlanetService.Utils.getGamePlanetServiceAsync().inserisciArticolo(articolo, new AbstractAsyncCallback<Void>(){

			@Override
			public void onSuccess(Void result) {
				Dialogs.showMessage("Articolo creato con successo");
				GamePlanetContext.getArticoliTree().reload();
		}});		
	}

	@Override
	public String getButtonLabel() {
		// TODO Auto-generated method stub
		return "Crea";
	}
}
